﻿Public NotInheritable Class FormasPago
    Private Sub LblClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtDescripcion.TextChanged
        Button1.Enabled = Convert.ToBoolean(TxtDescripcion.Text.Length)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Valores(1) As String
        Dim Campos(1) As String
        Dim k As UInt16 = 0
        Dim procName As String = "insertFrmPago"
        For Each Objeto As Control In Me.Controls
            If TypeOf Objeto Is TextBox Or TypeOf Objeto Is DateTimePicker Then
                Campos.SetValue(Objeto.Tag, k)
                Valores.SetValue(Objeto.Text, k)
                k += 1
            End If
        Next
        If Not DataAccess.InsertNewRecord(Campos, Valores, procName) Then
            MessageBox.Show("Error al guardar registro de Forma de Pago")
        Else
            Clientes.updateFormasPago()
            TxtDescripcion.Text = vbNullString
            TxtDescuento.Text = "0"
        End If
    End Sub
End Class
